<template>
  <div>
    <van-nav-bar
      :title="uname"
      left-arrow
      @click-left="$router.go(-1)"
    />
    <div class="sendmsg">
      <van-form @submit="onSubmit">
        <van-field
          v-model="content"
          name="content"
          label="消息框"
          placeholder="请输入消息"
          type="textarea"
        />
        <div style="margin: 16px;">
          <van-button round block type="info" native-type="submit">
            提交
          </van-button>
        </div>
      </van-form>
    </div>
  </div>
</template>
<script>
import {getCookie} from '@/utils/index'
export default {
  data () {
    return {
      uname:'',
      content:''
    }
  },
  mounted(){
    this.uname = this.$route.params.uname
    //发送信息给服务端  
    // this.$socket.emit('sendMsg',{  
    //   username: 'username',  
    //   password: 'password'  
    // });
  },
  methods:{
    onSubmit (values) {
      if(values.content){
        console.log('submit', values);
        const from = getCookie('userid')
        const to = this.$route.params.uid
        const content = values.content
       
      }
    }
  }
}
</script>
<style lang='less' scoped>
/deep/ .van-field__control{
  height: 80px;
}
</style>